package com.example.demo.tenant;

import com.example.demo.service.TenantDbConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @description: 项目启动 加载租户数据源
 * @date: 22:12 2020/1/14
 * @version: 1.0.0
 */
@Slf4j
@Component
public class LoadTenantDataSource implements CommandLineRunner {

    @Resource
    private TenantDbConfigService tenantDbConfigService;

    @Override
    public void run(String... args) {
        tenantDbConfigService.initDataSource();
    }
}